package com.lanjing.gateway.filter;

import org.springframework.cloud.gateway.filter.GatewayFilterChain;
import org.springframework.cloud.gateway.filter.GlobalFilter;
import org.springframework.http.server.RequestPath;
import org.springframework.stereotype.Component;
import org.springframework.web.server.ServerWebExchange;
import reactor.core.publisher.Mono;

/**
 * 内容摘要:网关过滤器的类
 *
 * @author: zyt
 * @date 2024-01-31 13:07
 */
@Component
public class GateWayFilter implements GlobalFilter {

    @Override
    public Mono<Void> filter(ServerWebExchange exchange, GatewayFilterChain chain) {
        RequestPath path = exchange.getRequest().getPath();
        System.out.println("进入了网关，请求的地址是：" + path.value());
        return chain.filter(exchange);
    }
}
